package utils;

import burp.api.montoya.http.message.responses.HttpResponse;

public class RequestUtil {


    /**
     * 获取响应内容长度
     *
     * @param response HTTP响应
     * @return 响应长度字符串
     */
    public static String getResponseLength(HttpResponse response) {
        if (response == null) {
            return "";
        }

        String contentLength = response.headerValue("Content-Length");
        if (contentLength != null && !contentLength.isEmpty()) {
            return contentLength;
        } else {
            return String.valueOf(response.toByteArray().length());
        }
    }
}
